var http = require("http");
var ejs = require("ejs");
var fs = require("fs");

http.createServer(function(req, res) {
	fs.readFile('./views/1.ejs', function(err, data) {
		if(err) {
			throw new Error("读取模板文件失败！");
			return ;
		}
		var template = data.toString();
		var dictionary = {info: "荣耀7", news: ["nodejs","study"]};
		var html = ejs.render(template, dictionary);
		res.writeHead(200,{"content-type":"text/html;charset=utf8"});
		res.end(html);
	});

	
}).listen(80,"127.0.0.1");
